class Admin::BaseDishesController < ApplicationController
  # GET /admin/base_dishes
  # GET /admin/base_dishes.xml
  def index
    @base_dishes = BaseDish.find(:all)

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @base_dishes }
    end
  end

  # GET /admin/base_dishes/1
  # GET /admin/base_dishes/1.xml
  def show
    @base_dish = BaseDish.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @base_dish }
    end
  end

  # GET /admin/base_dishes/new
  # GET /admin/base_dishes/new.xml
  def new
    @base_dish = BaseDish.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @base_dish }
    end
  end

  # GET /admin/base_dishes/1/edit
  def edit
    @base_dish = BaseDish.find(params[:id])
  end

  # POST /admin/base_dishes
  # POST /admin/base_dishes.xml
  def create
    @base_dish = BaseDish.new(params[:base_dish])

    respond_to do |format|
      if @base_dish.save
        flash[:notice] = 'BaseDish was successfully created.'
        format.html { redirect_to([:admin, @base_dish]) }
        format.xml  { render :xml => @base_dish, :status => :created, :location => @base_dish }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @base_dish.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /admin/base_dishes/1
  # PUT /admin/base_dishes/1.xml
  def update
    @base_dish = BaseDish.find(params[:id])

    respond_to do |format|
      if @base_dish.update_attributes(params[:base_dish])
        flash[:notice] = 'BaseDish was successfully updated.'
        format.html { redirect_to(@base_dish) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @base_dish.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /admin/base_dishes/1
  # DELETE /admin/base_dishes/1.xml
  def destroy
    @base_dish = BaseDish.find(params[:id])
    @base_dish.destroy

    respond_to do |format|
      format.html { redirect_to(admin_base_dishes_url) }
      format.xml  { head :ok }
    end
  end
end
